<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.infomanage.po.*"%>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.service.syscfg.*"%>
<%@page import="org.hibernate.*"%>
<%@page import="org.hibernate.cfg.*"%>
<%
	response.addDateHeader("Expires", 0);
	response.setHeader("Pragma", "no-cache");
	response.setHeader("Cache-Control", "no-cache");
%>
<%
	request.setCharacterEncoding("UTF-8");


	int count = 0;
	
	Session session1 = HibernateSessionFactory.getSession();
	String Hql = "From Department where level='" + 2 + "'";
	List list = null;
	try{
		Query q = session1.createQuery(Hql);
		list = q.list();
		if (list != null) {
			count = list.size();
		}
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		session1.close();
	}
%>
<html>
	<head>
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<link href="../../css/style.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../../js/common.js"></script>
		<script type="text/javascript">
		function delItem(id) {
			if(window.confirm("确定删除吗？")){
				actionFrame.location.href = "departManage_action.jsp?actionType=del&itemId=" + id;
			}
		}

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   if(info && info != "") {
		   		alert(info);
		   }
		   window.location.reload();
	   }
	</script>
	</head>
	<body rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0"
		onclick="parent.clickBody();">
		<table width="100%" height="100%" border="0" align="center"
			cellpadding="0" cellspacing="0"
			style="table-layout: fixed; background: #ffffff;">
			<tr height="29px">
				<td valign="middle" height="29px" class="td_title"
					style="padding-left: 20px; border-right: 1px #a3c6e2 solid;">
					单位列表
				</td>
			</tr>
			<tr>
				<td valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0"
						cellspacing="0" class="tabMain">
					
						<col width="80%">
					
						<col width="20%">
						<tr class="thlist">
			
							<td>
								单位名称
							</td>
						
							<td>
								操作
							</td>
						</tr>

						<!-- 输出数据 -->
						<tr valign="top">
							<td colspan="6" width="100%">
								<div style="width: 100%; height: 100%; overflow: auto;">
									<table style="table-layout: fixed;" cellpadding="0"
										cellspacing="0" class="altColorTable">
									
										<col width="80%">
									
										<col width="20%">
										<%
												if (list != null) {
												
												for (int i=0;i<list.size();i++) {
													Department dept=(Department)list.get(i);
										%>
										<tr class="tdlist">
									
											<td>
												<%=(dept.getName() == null ? "" :dept.getName())%>
											</td>
									
											<td>
												<a href="javascript:delItem('<%=dept.getDeptId()%>');"
													title="删除"><img src="../../img/dot_sc.gif" border="0">&nbsp;删除</a>
											</td>
										</tr>
										<%
											}
											}
										%>
									</table>
								</div>
							</td>
						</tr>
					</table>
				</td>
			</tr>


		</table>
		<iframe src="#" name="actionFrame" style="display: none;"></iframe>


	</body>
</html>
